# -*- coding: utf-8 -*-
# -注释测试-
# @Time    : 2019/7/7 15:46
# @Author  : hwx
# @Email   : @163.com
# @File    : 官方教程1_4.py
# 网址     : https://docs.python.org/zh-cn/3/tutorial/index.html
# @Software: PyCharm
# https://github.com/weishion/Python-100-Days.git


def fun1(ag, w, c):
    """
注释测试
    :param ag:
    :param w:
    :param c:
    """
    print(ag+w+c)


def fun2():
    """
斐波那契数列 的初始子序列
    """
    a, b = 0, 1
    while a < 10:
        # print('斐波那契数列a的值为：', a)
        print(a, end='-')  # 关键字参数 end 可以用来取消输出后面的换行, 或是用另外一个字符串来结尾:
        a, b = b, a+b

def fun3():
    words = ['cat', 'window', 'defenestrate']
    for w in words:
        print(w, len(w))


def fun4():
    words2 = ['cat', 'window', 'defenestrate']
    for w2 in words2[:]:
        print('进入for循环', w2)
        if len(w2) > 6:
            words2.insert(0, w2)
    print(words2)


def fun5():
    """
rang()函数
    """
    for i in range(5):
        print(i)
    for i2 in range(2, 5):
        print(i2)
    for i3 in range(0, 10, 2):  # 0开头。2为步长
        print(i3)
    for i4 in range(-1, -10, -2):
        print(i4)
    print('*********************************************')
    print(range(5))
    print(list(range(5)))


def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
    print("-- This parrot wouldn't", action, end=' ')
    print("if you put", voltage, "volts through it.")
    print("-- Lovely plumage, the", type)
    print("-- It's", state, "!")


def cheeseshop(kind, *arguments, **keywords):
    """
当存在一个形式为 **name 的正式形参时，它会接收一个0字典 .
形式为 *name，接收一个包含除了正式形参列表以外的位置参数的 元组 的正式形参 (将在下一小节介绍) 组合使用 (*name 必须出现在 **name 之前
    :param kind:
    :param arguments:元组
    :param keywords:字典
    """
    print("-- Do you have any", kind, "?")
    print("-- I'm sorry, we're all out of", kind)
    for arg in arguments:
        print(arg)
    print("-" * 40)
    for kw in keywords:
        print(kw, ":", keywords[kw])


def concat(*args, sep='/'):
    return sep.join(args)


# fun1(1, 2, 3)
# fun2()
# fun3()
# fun4()
# fun5()
# parrot(100, '2')
# parrot(voltage=11, state='222')   # parrot(voltage=11, '222')
# cheeseshop("Limburger", "It's very runny, sir.",
#            "It's really very, VERY runny, sir.",
#            店铺名="Michael Palin",
#            终端="John Cleese",
#            标语="Cheese Shop Sketch")
# print(concat('d', 'hwx', 'python'))
# print(concat('d', 'hwx', 'python', sep='.'))
# print(concat('d', 'hwx', 'python', '/'))

def fun19():
    ulisy = []
    sfl = []
    for j in range(7):
        for i in range(5):
            ulisy.append(i)
    sfl.append(ulisy)
    print(sfl)
fun19()
